import React from 'react';
// import { getCurrentPage } from 'utils/utils';
import { Link } from 'react-router-dom';
import Category from '../Category';
import Member from '../Member';

import styles from './index.module.less';

/*
* @author JinHang
* @description 导航组件
* @date 2018/10/22 15:56
* @param {}
* @return {}
* */
export default class Nav extends React.Component {
  state = {
    nav: [
      { key: 1, name: '首页', path: '/' },
      { key: 2, name: '交易市场', path: '/raw-material' },
      { key: 3, name: '咨询中心', path: '/news/latestnew' },
    ],
  };

  render() {
    const { nav } = this.state;

    return (
      <div className={styles.bannerNav}>
        <div className={`${styles.container} ${styles.clearfix}`}>
          <div className={styles.positionBox}>
            <div className={styles.categoryTitle + ' ' + styles.pullLeft}>
              <i className={`iconfont icon-quanbufenlei ${styles.titleIcon}`}></i>
              <span className={styles.text}>
                全部分类
              </span>
            </div>
            {
              nav.map((item, index) => {
                const classStr = styles.text; /* + (item.path === getCurrentPage() ? ' ' + styles.active : '') */

                return (
                  <div className={`${styles.navTextBox} ${styles.pullLeft}`} key={item.key}>
                    <Link className={classStr} to={item.path}>
                      {item.name}
                    </Link>
                  </div>
                );
              })
            }
            <div className={styles.navCategory}>
              <Category />
            </div>
            <div className={styles.navMember}>
              <Member />
            </div>
          </div>
        </div>
      </div>
    );
  }
}
